<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-7622210</id><updated>2011-04-21T23:05:38.540+04:00</updated><title type='text'>f_lynx.python.stuff</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://f_lynx_python.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7622210/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://f_lynx_python.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Alex A. Naanou</name><uri>http://www.blogger.com/profile/04281590737890681291</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>13</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-7622210.post-196631146771296586</id><published>2009-06-03T01:10:00.001+04:00</published><updated>2009-06-03T01:11:24.378+04:00</updated><title type='text'>Strike three!</title><content type='html'>I'm getting tired from how some people tend to do business in this country.&lt;br/&gt;&lt;br/&gt;So, from now on, every single project I lead there will be no excessive tolerance to incompetence; here's how it is, from now on:&lt;br/&gt;&lt;br/&gt;&lt;b&gt;The three strike rule&lt;/b&gt;:&lt;br/&gt;&lt;br/&gt;A person gets &lt;i&gt;three and only three&lt;/i&gt; chances: the first is when he/she gets the job, then there are two possible misbehaviors (missed deadlines without a reason, recklessness, quality below ones level, ... etc.) and the person of off the project, period.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7622210-196631146771296586?l=f_lynx_python.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://f_lynx_python.blogspot.com/feeds/196631146771296586/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7622210&amp;postID=196631146771296586' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7622210/posts/default/196631146771296586'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7622210/posts/default/196631146771296586'/><link rel='alternate' type='text/html' href='http://f_lynx_python.blogspot.com/2009/06/strike-three.html' title='Strike three!'/><author><name>Alex A. Naanou</name><uri>http://www.blogger.com/profile/04281590737890681291</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7622210.post-5621748239156681314</id><published>2009-01-07T17:17:00.001+03:00</published><updated>2009-01-07T17:17:20.070+03:00</updated><title type='text'>The evolution of the programmer...</title><content type='html'>A little story/joke I tell my students to explain the good and bad motivation they will face and to teach them where to look first:&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;There is a term in Russian programming culture called the &lt;i&gt;"programmer laziness"&lt;/i&gt; (&lt;i&gt;программистская лень&lt;/i&gt;) and it is a good thing, if one knows how to control it, that is.&lt;br/&gt;&lt;br/&gt;In general, it is exhibited by spending hours to automate the solving of a problem that would otherwise take five minutes to fix by hand. When this problem arises again most programmers will again dig in for hours but, some more advanced people will remember that they've already did it, will blow the dust off their old code, adjust it and run it again spending less time than it took to code in the first place but, still substantially more than it would take to do the work by hand. In turn, most of these people will repeat the process again and again every time they face the task, evolving their code. But, a fraction will notice a routine and write a &lt;i&gt;problem detector&lt;/i&gt; virtually eliminating the time spent on even considering the task (effectively, again, taking them to a new level of abstraction) only until a &lt;i&gt;sufficiently different&lt;/i&gt; problem is encountered and then the process needs to be repeated from the start. And so on.&lt;br/&gt;&lt;br/&gt;That was the &lt;i&gt;first evolutionary level&lt;/i&gt;.&lt;br/&gt;&lt;br/&gt;People who either have evolved to the second level or were born into it will say: &lt;i&gt;"Oh! now, I'm seeing this too often, I wonder what is causing it?"&lt;/i&gt; as soon as they see an error for the second time at max.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7622210-5621748239156681314?l=f_lynx_python.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://f_lynx_python.blogspot.com/feeds/5621748239156681314/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7622210&amp;postID=5621748239156681314' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7622210/posts/default/5621748239156681314'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7622210/posts/default/5621748239156681314'/><link rel='alternate' type='text/html' href='http://f_lynx_python.blogspot.com/2009/01/evolution-of-programmer.html' title='The evolution of the programmer...'/><author><name>Alex A. Naanou</name><uri>http://www.blogger.com/profile/04281590737890681291</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7622210.post-670908342232520182</id><published>2008-11-14T23:30:00.001+03:00</published><updated>2008-11-14T23:30:28.794+03:00</updated><title type='text'>a new tool! :)</title><content type='html'>http://gist.github.com/ ...quite useful :)&lt;br/&gt;&lt;br/&gt;it does this:&lt;br/&gt;&lt;script src="http://gist.github.com/25072.js"&gt;&lt;/script&gt;&lt;br/&gt;&lt;br/&gt;a very nice way to host and publish code!&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;a href="http://devver.net/blog/2008/11/displaying-code-on-your-blog/"&gt;via&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7622210-670908342232520182?l=f_lynx_python.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://f_lynx_python.blogspot.com/feeds/670908342232520182/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7622210&amp;postID=670908342232520182' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7622210/posts/default/670908342232520182'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7622210/posts/default/670908342232520182'/><link rel='alternate' type='text/html' href='http://f_lynx_python.blogspot.com/2008/11/new-tool.html' title='a new tool! :)'/><author><name>Alex A. Naanou</name><uri>http://www.blogger.com/profile/04281590737890681291</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7622210.post-3050468176899946890</id><published>2008-09-20T22:54:00.001+04:00</published><updated>2008-09-20T22:54:43.579+04:00</updated><title type='text'>web and computers...</title><content type='html'>One interesting tendency about the web these days is dramatic browser tech advancement.... just a mad idea, could this lead to practical self-applicability and/or developing the whole system in (or rather &lt;i&gt;as&lt;/i&gt;) a browser?&lt;br/&gt;&lt;br/&gt;And I do not mean things like &lt;i&gt;&lt;a href="http://en.wikipedia.org/wiki/Dan_Ingalls"&gt;Dan Ingalls'&lt;/a&gt; &lt;a href="http://research.sun.com/projects/lively/"&gt;Lively Kernel&lt;/a&gt;&lt;/i&gt;, no. The idea is more of a standalone bare browser/server on hardware that can be useful both connected or not. this could include a proxy cache as store; booting from the web or local server (loading data to the cache), working with the data locally and posting changes when the system is on-line.... redefining the personal computer concept in terms generally associated with the web.&lt;br/&gt;&lt;br/&gt;Some food for thought :)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7622210-3050468176899946890?l=f_lynx_python.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://f_lynx_python.blogspot.com/feeds/3050468176899946890/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7622210&amp;postID=3050468176899946890' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7622210/posts/default/3050468176899946890'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7622210/posts/default/3050468176899946890'/><link rel='alternate' type='text/html' href='http://f_lynx_python.blogspot.com/2008/09/web-and-computers.html' title='web and computers...'/><author><name>Alex A. Naanou</name><uri>http://www.blogger.com/profile/04281590737890681291</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7622210.post-6654944410011501264</id><published>2008-09-07T05:38:00.001+04:00</published><updated>2008-09-07T05:41:36.175+04:00</updated><title type='text'>OOP and framework cooperative reuse...</title><content type='html'>I've been hitting this problem for a couple of years now...&lt;br/&gt;&lt;br/&gt;here it is, in short: we have an algorithm or a set of algorithms that operate on one or several "terms", this is usually called a framework and implemented as a relatively monolithic (usually but not necessarily) entity with several customization points, and is used by replacing/customizing these points to achieve a variation of the provided functionality. there are numerous examples of this approach among which are the Python's logging package and the Twisted framework, to name a couple of big ones, on the smaller scale there are things like UserDict, ...etc. this approach works quite well but has two rather big weaknesses:&lt;br/&gt;&lt;ol&gt;&lt;br/&gt;  &lt;li&gt;the bigger things get the more unnecessary complexity of design and implementation there are and in some (if not most) cases this also relates to complexity of use...&lt;/li&gt;&lt;br/&gt;  &lt;li&gt;a framework is extremely hard to to implement in a way for it to be reused several times within one context...&lt;/li&gt;&lt;br/&gt;&lt;/ol&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;the second point may need a little explaining. let us consider this example: we have several frameworks that simplify pythons dict creation and use, these usually require the user to define only tree or four special methods and implement the rest of the dict interface on top of that... quite straight forward, indeed. so to demo the above concept let's try and implement an object that acts as a dict and at the same time responds to a special attribute interface, both protocols access different data stores and are essentially independent, but are almost identical in their base functionality.&lt;br/&gt;&lt;br/&gt;so some of the traditional approaches to solve this are:&lt;br/&gt;&lt;ol&gt;&lt;br/&gt;&lt;li&gt; &lt;i&gt;implement everything by hand.&lt;/i&gt;&lt;br/&gt;&lt;br/&gt;as far as my experience goes this appears to be one of the most popular ways to solve things. this is quite boring and bad so I'll skip the details and code example. &lt;/li&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;li&gt;&lt;i&gt;extend and wrap (the OOP way).&lt;/i&gt;&lt;br/&gt;&lt;br/&gt;In other words make the object a dict-like by extending a special framework and proxy the attr access to a nested container (or vice versa).&lt;br/&gt;&lt;br/&gt;here is an example:&lt;br/&gt;&lt;code&gt;&lt;pre&gt;&lt;br/&gt;import pli.pattern.proxy.utils as putils&lt;br/&gt;import pli.pattern.mixin.mapping as mapping&lt;br/&gt;&lt;br/&gt;# mapping.Mapping is quite similar to UserDict form the standard library but is quite a bit more &lt;br/&gt;# flexible. though, for this example it makes almost no difference except for the base methods&lt;br/&gt;# needed by each library are a but different.&lt;br/&gt;class DictLikeWithAttrs(mapping.Mapping):&lt;br/&gt;    _dict_data = None&lt;br/&gt;    # to add some fun, all of the instances have the same "base" state, yet still can store private &lt;br/&gt;    # data in their local namespace...&lt;br/&gt;    _attr_data = {}&lt;br/&gt;&lt;br/&gt;    def __init__(self):&lt;br/&gt;        self._dict_data = {}&lt;br/&gt;&lt;br/&gt;    # proxy the dict interface...&lt;br/&gt;    putils.proxymethods((&lt;br/&gt;            '__getitem__',&lt;br/&gt;            '__setitem__',&lt;br/&gt;            '__delitem__',&lt;br/&gt;            '__iter__',&lt;br/&gt;        ), '_dict_data')&lt;br/&gt;&lt;br/&gt;    # proxy the attr methods to the dict interface of the _attr_data...&lt;br/&gt;    putils.proxymethods((&lt;br/&gt;            ('__getattr__', '__getitem__'),&lt;br/&gt;            ('__delattr__', '__delitem__'),&lt;br/&gt;        ), '_attr_data')&lt;br/&gt;    # and we need to take special care with __setattr__ to avoid infinite recursion...&lt;br/&gt;    def __setattr__(self, name, val):&lt;br/&gt;        if name in ('_attr_data', '_dict_data'):&lt;br/&gt;            return super(DictLikeWithAttrs, self).__setattr__(name, val)&lt;br/&gt;        self._attr_data[name] = val&lt;br/&gt;&lt;br/&gt;    # this will set local attrs that have priority over the global state...&lt;br/&gt;    putils.proxymethod(&lt;br/&gt;        ('setlocal', '__setitem__'), '__dict__')&lt;br/&gt;&lt;/pre&gt;&lt;/code&gt;&lt;br/&gt;&lt;br/&gt;this approach has both it's advantages:&lt;br/&gt;&lt;ul&gt;&lt;li&gt;involves far less work than the first approach. &lt;/li&gt;&lt;br/&gt;&lt;li&gt;also is simpler, if proper tools and discipline are used. &lt;/li&gt;&lt;/ul&gt; &lt;br/&gt;&lt;br/&gt;and disadvantages:&lt;br/&gt;&lt;ul&gt;&lt;li&gt;the result is not too reusable or configurable. &lt;/li&gt;&lt;br/&gt;&lt;li&gt;not simple enough (IMHO). &lt;/li&gt;&lt;br/&gt;&lt;li&gt;scales badly -- we essentially have to proxy all the methods by hand. &lt;/li&gt;&lt;br/&gt;&lt;li&gt;another reason why this scales badly is that you can extend only once per protocol and for each consecutive use you need to nest. &lt;/li&gt;&lt;/ul&gt;&lt;br/&gt;&lt;br/&gt;just imagine how would an object that supports three or four different mapping-like interfaces look like...&lt;/li&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;li&gt;&lt;i&gt;write an interface factory.&lt;/i&gt;&lt;br/&gt;&lt;br/&gt;let's go straight to an example:&lt;br/&gt;&lt;code&gt;&lt;pre&gt;&lt;i&gt;&lt;br/&gt;def mappingproxy(target, get='__getitem__', set='__setitem__', delete='__delitem__', iter='__iter__', depth=1):&lt;br/&gt;    map = ()&lt;br/&gt;    # these will enable us to disable some methods...&lt;br/&gt;    if get != None:&lt;br/&gt;        map += ((get, '__getitem__'),)&lt;br/&gt;    if set != None:&lt;br/&gt;        map += ((set, '__setitem__'),)&lt;br/&gt;    if delete != None:&lt;br/&gt;        map += ((delete, '__delitem__'),)&lt;br/&gt;    if iter != None:&lt;br/&gt;        map += ((iter, '__iter__'),)&lt;br/&gt;    # sanity check...&lt;br/&gt;    if map == ():&lt;br/&gt;        raise TypeError, 'to generate a proxy we need at least one methods enabled.'&lt;br/&gt;    # now generate the proxies...&lt;br/&gt;    putils.proxymethods(map, target, &lt;br/&gt;        # this sets the namespace depth of the caller... (an off-topic, but in case you wounder :) )&lt;br/&gt;        depth=depth+1)&lt;br/&gt;&lt;br/&gt;def attrproxy(target, get='__getattr__', set='__setattr__', delete='__delattr__', iter=None, depth=1):&lt;br/&gt;    return mappingproxy(target, get=get, set=set, delete=delete, iter=iter, depth=depth+1)&lt;br/&gt;&lt;/i&gt;&lt;/pre&gt;&lt;/code&gt;&lt;br/&gt;&lt;br/&gt;so our class will look like this... (the changes are in &lt;i&gt;italic&lt;/i&gt;)&lt;br/&gt;&lt;code&gt;&lt;pre&gt;&lt;br/&gt;class DictLikeWithAttrs2(mapping.Mapping):&lt;br/&gt;    _dict_data = None&lt;br/&gt;    # to add some fun, all of the instances have the same "base" state, yet still can store private data...&lt;br/&gt;    _attr_data = {}&lt;br/&gt;&lt;br/&gt;    def __init__(self):&lt;br/&gt;        self._dict_data = {}&lt;br/&gt;&lt;i&gt;&lt;br/&gt;    mappingproxy('_dict_data')&lt;br/&gt;&lt;br/&gt;    attrproxy('_attr_data', set=None)&lt;/i&gt;&lt;br/&gt;    # and we need to take special care with __setattr__ to avoid infinite recursion...&lt;br/&gt;    def __setattr__(self, name, val):&lt;br/&gt;        if name in ('_attr_data', '_dict_data'):&lt;br/&gt;            return super(DictLikeWithAttrs2, self).__setattr__(name, val)&lt;br/&gt;        self._attr_data[name] = val&lt;br/&gt;&lt;br/&gt;    # this will set local attrs that have priority over the global state...&lt;br/&gt;    putils.proxymethod(&lt;br/&gt;        ('setlocal', '__setitem__'), '__dict__')&lt;br/&gt;&lt;/pre&gt;&lt;/code&gt;&lt;br/&gt;this is a good approach, we made the user code both shorter and more understandable (be it at an expense of adding some more complexity to the library). but, on the down side, our factory and generated code are rather static. &lt;br/&gt;&lt;br/&gt;in essence, by automating part of the process we made the whole thing less flexible.&lt;/li&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;li&gt;&lt;i&gt;design the interface "stackable" form the ground up.&lt;/i&gt;&lt;br/&gt;&lt;br/&gt;this is really bad as it makes everything dramatically more complex by adding dispatching to everything and confusing option and data registries/dicts/lists...&lt;/li&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;li&gt;&lt;i&gt;macros or templates.&lt;/i&gt;&lt;br/&gt;&lt;br/&gt;I'd avoid this at this point as I'm investigating a possibility of a clean OOP approach.&lt;/li&gt;&lt;br/&gt;&lt;/ol&gt;&lt;br/&gt;&lt;br/&gt;I regularly use the second and third approaches but, I'm looking for something that would feel more natural... &lt;br/&gt;&lt;br/&gt;In my view the best way to go would be defining a framework in a way that would isolate the algorithms from the terms they use, making the later overloadable. &lt;br/&gt;On the small scale this is the same as a simple function, where the functionality is black-boxed, the user just inputs the arguments and gets the result; but this does not scale to collections of functions or frameworks with ease. I can't seem to find anything that would fit this in any of the systems/languages I know of (but I could be missing a thing or two). &lt;br/&gt;&lt;br/&gt;&lt;br/&gt;Any Ideas? :)&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;P.S. you can find pli &lt;a href="http://repo.or.cz/w/pli.git"&gt;here...&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7622210-6654944410011501264?l=f_lynx_python.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://f_lynx_python.blogspot.com/feeds/6654944410011501264/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7622210&amp;postID=6654944410011501264' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7622210/posts/default/6654944410011501264'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7622210/posts/default/6654944410011501264'/><link rel='alternate' type='text/html' href='http://f_lynx_python.blogspot.com/2008/09/oop-and-framework-cooperative-reuse.html' title='OOP and framework cooperative reuse...'/><author><name>Alex A. Naanou</name><uri>http://www.blogger.com/profile/04281590737890681291</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7622210.post-1028215748048976324</id><published>2008-08-27T21:24:00.001+04:00</published><updated>2008-08-27T21:24:34.267+04:00</updated><title type='text'>the simplest design is allot more fun!</title><content type='html'>The first time I noticed this, I got quite surprised... the best solution for a given problem is the simplest, most straight forward, least thrilling and usually generates remarks like &lt;i&gt;"this is textbook stuff, too simple and uninteresting"&lt;/i&gt; and, in fact, that it may well be!&lt;br/&gt;but as a side-effect of simplicity one gets tiny code base and flexibility unrestrained by bells and whistles. The result is as complex as the task it solves without any extra automation and framework magic :)&lt;br/&gt;&lt;br/&gt;Yes, you get less of that Perl-ish &lt;i&gt;"I've written this but, even I do not understand how and why it works, but it does!"&lt;/i&gt; thrill and none of the satisfaction it brings... &lt;br/&gt;&lt;br/&gt;but getting the job done in a fraction of the time &lt;i&gt;and&lt;/i&gt; watching the client try to rip it apart and reject it as being too simple, too abstract or too optimistic and not being able to do so objectively, is allot more fun ;)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7622210-1028215748048976324?l=f_lynx_python.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://f_lynx_python.blogspot.com/feeds/1028215748048976324/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7622210&amp;postID=1028215748048976324' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7622210/posts/default/1028215748048976324'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7622210/posts/default/1028215748048976324'/><link rel='alternate' type='text/html' href='http://f_lynx_python.blogspot.com/2008/08/simplest-design-is-allot-more-fun.html' title='the simplest design is allot more fun!'/><author><name>Alex A. Naanou</name><uri>http://www.blogger.com/profile/04281590737890681291</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7622210.post-3587031744774588164</id><published>2008-08-25T03:38:00.001+04:00</published><updated>2008-08-25T03:38:44.617+04:00</updated><title type='text'>GPL?</title><content type='html'>I do understand the motivation and the cause that &lt;a href="http://www.stallman.org/"&gt;Mr. Stallman&lt;/a&gt; is fighting for here (and I'm with him on this!) but, somehow I do not feel comfortable &lt;i&gt;forcing people to be free&lt;/i&gt;...&lt;br/&gt;&lt;br/&gt;...so, I'm sticking with free free licenses for most of my work.&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;plus, &lt;i&gt;"forcing to be free"&lt;/i&gt; sounds quite familiar!&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;P.S. this is actually a tad late response to his visit to moscow this year :)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7622210-3587031744774588164?l=f_lynx_python.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://f_lynx_python.blogspot.com/feeds/3587031744774588164/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7622210&amp;postID=3587031744774588164' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7622210/posts/default/3587031744774588164'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7622210/posts/default/3587031744774588164'/><link rel='alternate' type='text/html' href='http://f_lynx_python.blogspot.com/2008/08/gpl.html' title='GPL?'/><author><name>Alex A. Naanou</name><uri>http://www.blogger.com/profile/04281590737890681291</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7622210.post-7593720230829340159</id><published>2008-07-30T16:02:00.001+04:00</published><updated>2008-07-30T16:02:10.211+04:00</updated><title type='text'>it's time to revive this blog :)</title><content type='html'>I've not been writing on this topic for quite sime time. I'll try to make myself do this on a more regular basis now...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7622210-7593720230829340159?l=f_lynx_python.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://f_lynx_python.blogspot.com/feeds/7593720230829340159/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7622210&amp;postID=7593720230829340159' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7622210/posts/default/7593720230829340159'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7622210/posts/default/7593720230829340159'/><link rel='alternate' type='text/html' href='http://f_lynx_python.blogspot.com/2008/07/it-time-to-revive-this-blog.html' title='it&amp;#39;s time to revive this blog :)'/><author><name>Alex A. Naanou</name><uri>http://www.blogger.com/profile/04281590737890681291</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7622210.post-2789645595289957958</id><published>2008-03-26T13:34:00.003+03:00</published><updated>2008-03-26T13:55:22.916+03:00</updated><title type='text'>redesign and rewrite is good!</title><content type='html'>One funny thing I've noticed over the years is the more you get attached to a particular design the less you notice it's drawbacks and the more you like it, regardless of either quality or applicability to a particular purpose.&lt;br /&gt;&lt;br /&gt;A way to avoid this set of problems I've thought of a couple of years back is to &lt;em&gt;not to like any design by default and as soon as it starts to annoy do a redesign or a rewrite&lt;/em&gt;. &lt;br /&gt;&lt;br /&gt;So here are the preliminary results:&lt;br /&gt;+ after a couple of rewrites one instinctively motivated to write small and clear code.&lt;br /&gt;+ each consecutive rewrite/redesign is faster and faster.&lt;br /&gt;+ the designer gets a deeper and more practical view of the problem.&lt;br /&gt;+ good for teaching design.&lt;br /&gt;+ after a couple of cycles there is a sufficient codebase to combine the strongs of several approaches without a major rewrite.&lt;br /&gt;+ forces a certain concise and flexible design style.&lt;br /&gt;- this approach (in it's current state) is not suited for teems with varied experience levels.&lt;br /&gt;- may not be deterministic at first.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;One other thing I've noticed is that at first it takes more time that the usual approaches, but at the later stages there is virtually no time spent on hacking design bugs out and fixing all that depended on them in a crunch.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Agile is a similar set of approaches, but the difference here is that on each stage there is mainly a &lt;em&gt;forced redesign and rewrite&lt;/em&gt;, targeting solving the problem differently and not reusing code.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7622210-2789645595289957958?l=f_lynx_python.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://f_lynx_python.blogspot.com/feeds/2789645595289957958/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7622210&amp;postID=2789645595289957958' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7622210/posts/default/2789645595289957958'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7622210/posts/default/2789645595289957958'/><link rel='alternate' type='text/html' href='http://f_lynx_python.blogspot.com/2008/03/redesign-and-rewrite-is-good.html' title='redesign and rewrite is good!'/><author><name>Alex A. Naanou</name><uri>http://www.blogger.com/profile/04281590737890681291</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7622210.post-109178944382775661</id><published>2004-08-06T14:49:00.000+04:00</published><updated>2006-10-10T09:26:51.266+04:00</updated><title type='text'>The @decorator flaws...</title><content type='html'>First of all I must state that I agree with all who think this is un-pythonic.&lt;br /&gt;but considering the facts, I can not do anything about it.... thus to the purpose of this post:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;i&gt;&lt;b&gt;If you go for it, go all the way!!!&lt;/b&gt;&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;I just set up Py2.4a2 and found out the following (can't say I am surprised):&lt;br /&gt;&lt;br /&gt;- you can not decorate anything but a function!!&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;this is a shame, as it would be logical to expect this to work for the following cases:&lt;br /&gt;1) variables/attributes&lt;br /&gt;Example:&lt;br /&gt;&lt;pre&gt;class A(object):&lt;br /&gt;    @readonly&lt;br /&gt;    someattr = 0&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;or&lt;br /&gt;&lt;pre&gt;@register_in_store&lt;br /&gt;obj = SomeClass()&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;2) classes&lt;br /&gt;Example:&lt;br /&gt;&lt;pre&gt;@prepare&lt;br /&gt;class A(object):&lt;br /&gt;    someattr = 0&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;each and every of the above cases currently generates a syntax error.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;P.S. I'm thinking of posting this as a bug or feature request (but it needs more thought before I do)....&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7622210-109178944382775661?l=f_lynx_python.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://f_lynx_python.blogspot.com/feeds/109178944382775661/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7622210&amp;postID=109178944382775661' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7622210/posts/default/109178944382775661'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7622210/posts/default/109178944382775661'/><link rel='alternate' type='text/html' href='http://f_lynx_python.blogspot.com/2004/08/decorator-flaws.html' title='The @decorator flaws...'/><author><name>Alex A. Naanou</name><uri>http://www.blogger.com/profile/04281590737890681291</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7622210.post-109031211998320065</id><published>2004-07-20T12:22:00.000+04:00</published><updated>2004-07-20T13:01:59.126+04:00</updated><title type='text'>here is the problem in more detail...</title><content type='html'>It is the same as with "super(self.__class__, self).meth()", that is, as soon as you change, or combine metaclasses for some child class, you'll get wrong method resolution, and most likely fall into infinite recursion... (see example below).&lt;br /&gt;&lt;br /&gt;the simplest solution would be to pass the metaclass to super explicitly, but this is even worse than passing the class explicitly in the general case, as the class and the metaclass can be located in different modules/packages... etc. I can't say that this will contribute to code clarity :)&lt;br /&gt;&lt;br /&gt;&lt;b&gt;example:&lt;/b&gt;&lt;br /&gt;&lt;pre style="color: #000000; background-color: #f2f2f2; line-height:1.1em"&gt;&lt;br /&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #a020f0;"&gt;import&lt;/span&gt; metaclass_example&lt;br /&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #000080; font-weight: bold;"&gt;class&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;_OtherMetaClass&lt;/span&gt;(&lt;span style="color: #0000ff;"&gt;type&lt;/span&gt;):&lt;br /&gt;    &lt;span style="color: #000000; background-color: #f2f2f2;"&gt;'''&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #a0a0ff; background-color: #fafafa;"&gt;    &lt;/span&gt;&lt;span style="color: #000000; background-color: #f2f2f2;"&gt;'''&lt;/span&gt;&lt;br /&gt;    &lt;span style="color: #000080; font-weight: bold;"&gt;def&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;meth&lt;/span&gt;(cls):&lt;br /&gt;        &lt;span style="color: #000080; font-weight: bold;"&gt;print&lt;/span&gt; &lt;span style="color: #000000; background-color: #f2f2f2;"&gt;'&lt;/span&gt;&lt;span style="color: #a0a0ff; background-color: #fafafa;"&gt;this is the other metaclass method!!&lt;/span&gt;&lt;span style="color: #000000; background-color: #f2f2f2;"&gt;'&lt;/span&gt;&lt;br /&gt;        &lt;span style="color: #999999; font-style: italic;"&gt;# here super is in a try block so as to make the method usable&lt;/span&gt;&lt;br /&gt;        &lt;span style="color: #999999; font-style: italic;"&gt;# as is (not only from class combinations).&lt;/span&gt;&lt;br /&gt;        &lt;span style="color: #999999; font-style: italic;"&gt;#                                  ....a terminated super! :))&lt;/span&gt;&lt;br /&gt;        &lt;span style="color: #000080; font-weight: bold;"&gt;try&lt;/span&gt;:&lt;br /&gt;            &lt;span style="color: #0000ff;"&gt;super&lt;/span&gt;(cls.__class__, cls).meth()&lt;br /&gt;        &lt;span style="color: #000080; font-weight: bold;"&gt;except&lt;/span&gt; &lt;span style="color: #ff0000;"&gt;AttributeError&lt;/span&gt;:&lt;br /&gt;            &lt;span style="color: #000080; font-weight: bold;"&gt;pass&lt;/span&gt;&lt;br /&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #000080; font-weight: bold;"&gt;class&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;SomeUsefullClass&lt;/span&gt;(object):&lt;br /&gt;    &lt;span style="color: #000000; background-color: #f2f2f2;"&gt;'''&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #a0a0ff; background-color: #fafafa;"&gt;    &lt;/span&gt;&lt;span style="color: #000000; background-color: #f2f2f2;"&gt;'''&lt;/span&gt;&lt;br /&gt;    __metaclass__ = _OtherMetaClass&lt;br /&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #999999; font-style: italic;"&gt;#&lt;/span&gt;&lt;span style="color: #a0a0ff; font-style: italic;"&gt; NOTE:&lt;/span&gt;&lt;span style="color: #999999; font-style: italic;"&gt; here we inherit from two classes which are of different types&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #999999; font-style: italic;"&gt;#       or metaclasses, thus creating a metaclass conflict.&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #999999; font-style: italic;"&gt;#       to resolve this conflict we need to &amp;quot;combine&amp;quot; the metaclasses&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #999999; font-style: italic;"&gt;#       of the parent classes....&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #000080; font-weight: bold;"&gt;class&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;_CombinationMetaclass&lt;/span&gt;(_OtherMetaClass, metaclass_example._MetaClass):&lt;br /&gt;    &lt;span style="color: #000000; background-color: #f2f2f2;"&gt;'''&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #a0a0ff; background-color: #fafafa;"&gt;    &lt;/span&gt;&lt;span style="color: #000000; background-color: #f2f2f2;"&gt;'''&lt;/span&gt;&lt;br /&gt;    &lt;span style="color: #000080; font-weight: bold;"&gt;pass&lt;/span&gt;&lt;br /&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #999999; font-style: italic;"&gt;# and here is an innocent looking result.... :)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #000080; font-weight: bold;"&gt;class&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;KillerClass&lt;/span&gt;(metaclass_example.SomeOtherClass, SomeUsefullClass):&lt;br /&gt;    &lt;span style="color: #000000; background-color: #f2f2f2;"&gt;'''&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #a0a0ff; background-color: #fafafa;"&gt;    &lt;/span&gt;&lt;span style="color: #000000; background-color: #f2f2f2;"&gt;'''&lt;/span&gt;&lt;br /&gt;    __metaclass__ = _CombinationMetaclass&lt;br /&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;    &lt;span style="color: #000080; font-weight: bold;"&gt;def&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;meth&lt;/span&gt;(cls):&lt;br /&gt;        &lt;span style="color: #000000; background-color: #f2f2f2;"&gt;'''&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #a0a0ff; background-color: #fafafa;"&gt;        &lt;/span&gt;&lt;span style="color: #000000; background-color: #f2f2f2;"&gt;'''&lt;/span&gt;&lt;br /&gt;        &lt;span style="color: #000080; font-weight: bold;"&gt;print&lt;/span&gt; &lt;span style="color: #000000; background-color: #f2f2f2;"&gt;'&lt;/span&gt;&lt;span style="color: #a0a0ff; background-color: #fafafa;"&gt;hi from the killer :)&lt;/span&gt;&lt;span style="color: #000000; background-color: #f2f2f2;"&gt;'&lt;/span&gt;&lt;br /&gt;        &lt;span style="color: #0000ff;"&gt;super&lt;/span&gt;(cls.__class__, cls).meth()&lt;br /&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #000080; font-weight: bold;"&gt;if&lt;/span&gt; __name__ == &lt;span style="color: #000000; background-color: #f2f2f2;"&gt;'&lt;/span&gt;&lt;span style="color: #a0a0ff; background-color: #fafafa;"&gt;__main__&lt;/span&gt;&lt;span style="color: #000000; background-color: #f2f2f2;"&gt;'&lt;/span&gt;:&lt;br /&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;    SomeUsefullClass.meth()&lt;br /&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;    killer = KillerClass()&lt;br /&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;    &lt;span style="color: #000080; font-weight: bold;"&gt;print&lt;/span&gt; &lt;span style="color: #000000; background-color: #f2f2f2;"&gt;'&lt;/span&gt;&lt;span style="color: #a0a0ff; background-color: #fafafa;"&gt;BANG!!!&lt;/span&gt;&lt;span style="color: #000000; background-color: #f2f2f2;"&gt;'&lt;/span&gt;&lt;br /&gt;    killer.meth()&lt;br /&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #999999; font-style: italic;"&gt;# &lt;/span&gt;&lt;span style="color: #a0a0ff; font-style: italic;"&gt;vim: set ts=4 sw=4 nowrap :&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.mx1.ru/~f_lynx/python/misc/metaclass_example_killer.py"&gt;metaclass_example_killer.py&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;P.S. I made a little typo in the module name in the main post (the word example was lacking the "p" :) ), now this is corrected...&lt;br /&gt;&lt;br /&gt;this was originaly posted &lt;a href="http://www.livejournal.com/community/python_dev/23174.html?thread=114054#t114054"&gt;here&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7622210-109031211998320065?l=f_lynx_python.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://f_lynx_python.blogspot.com/feeds/109031211998320065/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7622210&amp;postID=109031211998320065' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7622210/posts/default/109031211998320065'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7622210/posts/default/109031211998320065'/><link rel='alternate' type='text/html' href='http://f_lynx_python.blogspot.com/2004/07/here-is-problem-in-more-detail.html' title='here is the problem in more detail...'/><author><name>Alex A. Naanou</name><uri>http://www.blogger.com/profile/04281590737890681291</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7622210.post-109009681289141319</id><published>2004-07-18T00:38:00.000+04:00</published><updated>2004-07-20T12:51:34.906+04:00</updated><title type='text'>ugly super class-method call...</title><content type='html'>Yesterday I stumbled on a funny problem :)&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Task:&lt;/b&gt;&lt;br /&gt;call the original class-method extended by another class-method in a subclass.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Logical Answer:&lt;/b&gt;&lt;br /&gt;use the super function.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;The Problem:&lt;/b&gt;&lt;br /&gt;considering that the way "super" is called, is not the most beautiful feature of the Python language (this is sed to be a wart by some). this situation created a code far uglier. to be honest, I hate this solution but I can't seem to come up with a better one... does anyone have any suggestions?&lt;br /&gt;&lt;br /&gt;the problem is that there are situations (though quite rare, or even unlikely) when this code will break!&lt;br /&gt;&lt;br /&gt;&lt;i&gt;see the example below for more details...&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;a full example:&lt;/b&gt;&lt;br /&gt;&lt;pre style="padding: 15px; color: #000000; background-color: #f2f2f2;line-height:1.1em"&gt;&lt;br /&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #000080; font-weight: bold;"&gt;class&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;SomeBaseClass&lt;/span&gt;(object):&lt;br /&gt;    &lt;span style="color: #000000; background-color: #f2f2f2;"&gt;'''&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #a0a0ff; background-color: #fafafa;"&gt;    &lt;/span&gt;&lt;span style="color: #000000; background-color: #f2f2f2;"&gt;'''&lt;/span&gt;&lt;br /&gt;    &lt;span style="color: #000080; font-weight: bold;"&gt;def&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;meth&lt;/span&gt;(self):&lt;br /&gt;        &lt;span style="color: #000000; background-color: #f2f2f2;"&gt;'''&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #a0a0ff; background-color: #fafafa;"&gt;        &lt;/span&gt;&lt;span style="color: #000000; background-color: #f2f2f2;"&gt;'''&lt;/span&gt;&lt;br /&gt;        &lt;span style="color: #000080; font-weight: bold;"&gt;print&lt;/span&gt; &lt;span style="color: #000000; background-color: #f2f2f2;"&gt;'&lt;/span&gt;&lt;span style="color: #a0a0ff; background-color: #fafafa;"&gt;###&lt;/span&gt;&lt;span style="color: #000000; background-color: #f2f2f2;"&gt;'&lt;/span&gt;, self, self.__class__&lt;br /&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #000080; font-weight: bold;"&gt;class&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;_MetaClass&lt;/span&gt;(SomeBaseClass, &lt;span style="color: #0000ff;"&gt;type&lt;/span&gt;):&lt;br /&gt;    &lt;span style="color: #000000; background-color: #f2f2f2;"&gt;'''&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #a0a0ff; background-color: #fafafa;"&gt;    &lt;/span&gt;&lt;span style="color: #000000; background-color: #f2f2f2;"&gt;'''&lt;/span&gt;&lt;br /&gt;    &lt;span style="color: #000080; font-weight: bold;"&gt;def&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;__init__&lt;/span&gt;(cls, name, bases, ns):&lt;br /&gt;        &lt;span style="color: #000000; background-color: #f2f2f2;"&gt;'''&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #a0a0ff; background-color: #fafafa;"&gt;        &lt;/span&gt;&lt;span style="color: #000000; background-color: #f2f2f2;"&gt;'''&lt;/span&gt;&lt;br /&gt;        &lt;span style="color: #000080; font-weight: bold;"&gt;if&lt;/span&gt; &lt;span style="color: #000000; background-color: #f2f2f2;"&gt;'&lt;/span&gt;&lt;span style="color: #a0a0ff; background-color: #fafafa;"&gt;meth&lt;/span&gt;&lt;span style="color: #000000; background-color: #f2f2f2;"&gt;'&lt;/span&gt; &lt;span style="color: #000080; font-weight: bold;"&gt;in&lt;/span&gt; ns:&lt;br /&gt;            &lt;span style="color: #0000ff;"&gt;setattr&lt;/span&gt;(cls, &lt;span style="color: #000000; background-color: #f2f2f2;"&gt;'&lt;/span&gt;&lt;span style="color: #a0a0ff; background-color: #fafafa;"&gt;meth&lt;/span&gt;&lt;span style="color: #000000; background-color: #f2f2f2;"&gt;'&lt;/span&gt;, &lt;span style="color: #0000ff;"&gt;classmethod&lt;/span&gt;(ns[&lt;span style="color: #000000; background-color: #f2f2f2;"&gt;'&lt;/span&gt;&lt;span style="color: #a0a0ff; background-color: #fafafa;"&gt;meth&lt;/span&gt;&lt;span style="color: #000000; background-color: #f2f2f2;"&gt;'&lt;/span&gt;]))&lt;br /&gt;        &lt;span style="color: #0000ff;"&gt;super&lt;/span&gt;(_MetaClass, cls).__init__(name, bases, ns)&lt;br /&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #000080; font-weight: bold;"&gt;class&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;SomeClass&lt;/span&gt;(object):&lt;br /&gt;    &lt;span style="color: #000000; background-color: #f2f2f2;"&gt;'''&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #a0a0ff; background-color: #fafafa;"&gt;    &lt;/span&gt;&lt;span style="color: #000000; background-color: #f2f2f2;"&gt;'''&lt;/span&gt;&lt;br /&gt;    __metaclass__ = _MetaClass&lt;br /&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #000080; font-weight: bold;"&gt;class&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;SomeOtherClass&lt;/span&gt;(object):&lt;br /&gt;    &lt;span style="color: #000000; background-color: #f2f2f2;"&gt;'''&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #a0a0ff; background-color: #fafafa;"&gt;    &lt;/span&gt;&lt;span style="color: #000000; background-color: #f2f2f2;"&gt;'''&lt;/span&gt;&lt;br /&gt;    __metaclass__ = _MetaClass&lt;br /&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;    &lt;span style="color: #000080; font-weight: bold;"&gt;def&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;meth&lt;/span&gt;(cls):&lt;br /&gt;        &lt;span style="color: #000000; background-color: #f2f2f2;"&gt;'''&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #a0a0ff; background-color: #fafafa;"&gt;        &lt;/span&gt;&lt;span style="color: #000000; background-color: #f2f2f2;"&gt;'''&lt;/span&gt;&lt;br /&gt;        &lt;span style="color: #000080; font-weight: bold;"&gt;print&lt;/span&gt; &lt;span style="color: #000000; background-color: #f2f2f2;"&gt;'&lt;/span&gt;&lt;span style="color: #a0a0ff; background-color: #fafafa;"&gt;this is a class-method...&lt;/span&gt;&lt;span style="color: #000000; background-color: #f2f2f2;"&gt;'&lt;/span&gt;&lt;br /&gt;        &lt;span style="color: #999999; font-style: italic;"&gt;# and here is the problematic line of code:&lt;/span&gt;&lt;br /&gt;        &lt;span style="color: #0000ff;"&gt;super&lt;/span&gt;(cls.__class__, cls).meth() &lt;span style="color: #999999; font-style: italic;"&gt;# or super(cls.__metaclass__, cls).meth()&lt;/span&gt;&lt;br /&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #000080; font-weight: bold;"&gt;if&lt;/span&gt; __name__ == &lt;span style="color: #000000; background-color: #f2f2f2;"&gt;'&lt;/span&gt;&lt;span style="color: #a0a0ff; background-color: #fafafa;"&gt;__main__&lt;/span&gt;&lt;span style="color: #000000; background-color: #f2f2f2;"&gt;'&lt;/span&gt;:&lt;br /&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;    basic_obj = SomeBaseClass()&lt;br /&gt;    some_other_obj = SomeOtherClass()&lt;br /&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;    basic_obj.meth()&lt;br /&gt;    SomeClass.meth()&lt;br /&gt;    some_other_obj.meth()&lt;br /&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #999999; font-style: italic;"&gt;# &lt;/span&gt;&lt;span style="color: #a0a0ff; font-style: italic;"&gt;vim: set ts=4 sw=4 nowrap :&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.mx1.ru/~f_lynx/python/misc/metaclass_examle.py"&gt;metaclass_examle.py&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;if anyone is interested, this is a simplified version of the structure of a module  (pli.event.event or a shorthand pli.event), part of the &lt;a href="http://pli.sf.net/"&gt;pli&lt;/a&gt; library.&lt;br /&gt;&lt;br /&gt;this was originaly posted &lt;a href="http://www.livejournal.com/community/python_dev/23174.html"&gt;here&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7622210-109009681289141319?l=f_lynx_python.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://f_lynx_python.blogspot.com/feeds/109009681289141319/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7622210&amp;postID=109009681289141319' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7622210/posts/default/109009681289141319'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7622210/posts/default/109009681289141319'/><link rel='alternate' type='text/html' href='http://f_lynx_python.blogspot.com/2004/07/ugly-super-class-method-call.html' title='ugly super class-method call...'/><author><name>Alex A. Naanou</name><uri>http://www.blogger.com/profile/04281590737890681291</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7622210.post-109009039353464378</id><published>2004-07-17T22:48:00.000+04:00</published><updated>2004-07-17T22:53:13.533+04:00</updated><title type='text'>The most promessing python projects IMHO</title><content type='html'>&lt;a href="http://psyco.sf.net/"&gt;Psyco&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.cosc.canterbury.ac.nz/~greg/python/Pyrex/"&gt;Pyrex&lt;/a&gt;&lt;br /&gt;&lt;a href="http://pypy.org"&gt;PyPy&lt;/a&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7622210-109009039353464378?l=f_lynx_python.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://f_lynx_python.blogspot.com/feeds/109009039353464378/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7622210&amp;postID=109009039353464378' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7622210/posts/default/109009039353464378'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7622210/posts/default/109009039353464378'/><link rel='alternate' type='text/html' href='http://f_lynx_python.blogspot.com/2004/07/most-promessing-python-projects-imho.html' title='The most promessing python projects IMHO'/><author><name>Alex A. Naanou</name><uri>http://www.blogger.com/profile/04281590737890681291</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
